import type { ColumnProps, TableProps } from 'ant-design-vue/lib/table/interface'
import type { PaginationProps } from 'ant-design-vue/lib/pagination/Pagination'
import type { ButtonProps } from 'ant-design-vue/lib/button/buttonTypes'

export interface Option {
  value?: any
  label?: any
}

export interface Action {
  type: 'popconfirm' | 'select' | 'button' | 'text' // 控制类型，默认为a,可选： select | button | text
  text: string
  style?: any
  color?: any
  key?: any
  options?: Option[]
  props?: ButtonProps | any
  func?: ({ text, record, router, index }, callback: (...rest) => any) => any // 动作事件触发回调
}

export interface Column extends ColumnProps {
  dataIndex: string
  title: string
  key?: any
  linkPath?: string | number
  width?: number
  linkId?: any
  slots?: {
    customRender?: any
  }
  slotsType?: 'format' | 'link' | 'component'
  slotsFunc?: (...rest) => any
  actions?: Action[]
}

// export type pageOption = Partial<typeof PaginationProps>
export type pageOption = Partial<PaginationProps>

export interface Props extends Omit<TableProps, 'columns'> {
  columns: Column[]
  rowKey: string | ((record: any) => string)
  pageOption: pageOption
  getListFunc: (prams) => any
  dragColEnable: boolean // 是否可以拖拽列
  dragRowEnable: boolean // 是否可以拖拽行
}
